const { Schema } = require("mongoose")
let mongoose = require("./db")

const sederSchema = new mongoose.Schema({
    title: String,
});
const sederModel = mongoose.model("seder", sederSchema, 'seder');
const conSchema = new mongoose.Schema({
    title: String,
    bid: {
        type: mongoose.Types.ObjectId,
        ref: "seder"
    }
    
});
const conModel = mongoose.model("con", conSchema, 'con');

const courseSchema = new mongoose.Schema({
    title: String,
    image: String,
    num: Number,
    price: Number,
    discount: Number,
    cid: {
        type: mongoose.Types.ObjectId,
        ref: "con"
    },
    timage: String,
    tname: String,
    tfans: String,
    mycourse: Boolean
})
const courseModel = mongoose.model("course", courseSchema, 'course');

const curriculumSchema = new mongoose.Schema({
    title: String,
    radio: String,
})
const curriculumModel = mongoose.model("curriculum", curriculumSchema, 'curriculum');

const orderSchema = new mongoose.Schema({
    title: String,
    image: String,
    price: Number,
    orderprice: Number,
    discount:Number,
    create_time:Date
})
const orderModel = mongoose.model("order", orderSchema, 'order');
module.exports = { conModel, sederModel, courseModel, curriculumModel, orderModel };
